<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 *
 */
require_once ( LIB_DIR.'search/shopsearch.php' );

//$mode = SPH_MATCH_ALL;
//$host = "localhost";
//$port = 3312;
//$index = "*";
//$groupby = "";
//$groupsort = "@group desc";
//$filter = "group_id";
//$filtervals = array();
//$distinct = "";
//$sortby = "";
//$limit = 20;
//$ranker = SPH_RANK_PROXIMITY_BM25;
//$select = "";
//
//$cl->SetServer ( $host, $port );
//$cl->SetConnectTimeout ( 1 );
//$cl->SetWeights ( array ( 100, 1 ) );
//$cl->SetMatchMode ( $mode );
//if ( count($filtervals) )
//    $cl->SetFilter ( $filter, $filtervals );
//if ( $groupby )
//    $cl->SetGroupBy ( $groupby, SPH_GROUPBY_ATTR, $groupsort );
//if ( $sortby )
//    $cl->SetSortMode ( SPH_SORT_EXTENDED, $sortby );
////if ( $sortexpr )            $cl->SetSortMode ( SPH_SORT_EXPR, $sortexpr );
//if ( $distinct )
//    $cl->SetGroupDistinct ( $distinct );
//if ( $select )
//    $cl->SetSelect ( $select );
//if ( $limit )
//    $cl->SetLimits ( 0, $limit, ( $limit>1000 ) ? $limit : 1000 );
//$cl->SetRankingMode ( $ranker );
//$cl->SetArrayResult ( true );
//$res = $cl->Query ( $keyword, $index );
//
//////////////////
//// print me out
//////////////////
//
//if ( $res===false ) {
//    print "Query failed: " . $cl->GetLastError() . ".\n";
//
//} else {
//    if ( $cl->GetLastWarning() )
//        print "WARNING: " . $cl->GetLastWarning() . "\n\n";
//
//    print "Query '$q' retrieved $res[total] of $res[total_found] matches in $res[time] sec.\n";
//    print "Query stats:\n";
//    if ( is_array($res["words"]) )
//        foreach ( $res["words"] as $word => $info )
//            print "    '$word' found $info[hits] times in $info[docs] documents\n";
//    print "\n";
//
//    if ( is_array($res["matches"]) ) {
//    //      print_r($res);
//        $n = 1;
//        print "Matches:\n";
//
//        $resultIds = array();
//        foreach ( $res["matches"] as $docinfo ) {
////            print "$n. doc_id=$docinfo[id], weight=$docinfo[weight]";
////            foreach ( $res["attrs"] as $attrname => $attrtype ) {
////                $value = $docinfo["attrs"][$attrname];
////                if ( $attrtype & SPH_ATTR_MULTI ) {
////                    $value = "(" . join ( ",", $value ) .")";
////                } else {
////                    if ( $attrtype==SPH_ATTR_TIMESTAMP )
////                        $value = date ( "Y-m-d H:i:s", $value );
////                }
////                print ", $attrname=$value";
////            }
////            print "\n";
//
//            $resultIds[] = $docinfo['id'];
//            $n++;
//        }
//
//        $strIds = implode(",", $resultIds);
//        $dbRes = $dbInstance->GetPlan( "select * from shop_info where id in (".$strIds.")" );
//
//        //shift all the string fields and processing the highlights
//        print_r($dbRes);
//    }
//}

?>
